Skip to content

Conversation

brianquinlan
Copy link
Collaborator

@brianquinlan brianquinlan commented Jul 21, 2025

  • Also increases the JVM heap limit so that the APK can be built reliably.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Copy link

Package publishing

Package Version Status Publish tag (post-merge)
package:cronet_http 1.5.0-wip WIP (no publish necessary)
package:cupertino_http 2.3.0-wip WIP (no publish necessary)
package:http 1.5.0-beta.2 already published at pub.dev
package:http2 3.0.0 ready to publish http2-v3.0.0
package:http_multi_server 3.2.2 already published at pub.dev
package:http_parser 4.1.2 already published at pub.dev
package:http_profile 0.1.1-wip WIP (no publish necessary)
package:ok_http 0.1.1-wip WIP (no publish necessary)
package:web_socket 1.0.1 already published at pub.dev
package:web_socket_channel 3.0.3 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Copy link

PR Health

Breaking changes ⚠️
Package Change Current Version New Version Needed Version Looking good?
cronet_http Breaking 1.4.0 1.5.0-wip 2.0.0
Got "1.5.0-wip" expected >= "2.0.0" (breaking changes)
⚠️

This check can be disabled by tagging the PR with skip-breaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ⚠️
File Coverage
pkgs/cronet_http/example/integration_test/client_profile_test.dart 💔 Not covered
pkgs/cronet_http/example/integration_test/client_test.dart 💔 Not covered
pkgs/cronet_http/lib/src/cronet_client.dart 💔 Not covered
pkgs/cronet_http/lib/src/jni/jni_bindings.dart 💔 Not covered

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/http/example/main.dart

Copy link
Member

@HosseinYousefi HosseinYousefi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -345,6 +345,29 @@ jb.UrlRequestCallbackProxy$UrlRequestCallbackInterface _urlRequestCallbacks(
}
jByteBuffer?.release();
},
// Will always be the last callback invoked.
// See https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/UrlRequest#cancel()
onCanceled: (urlRequest, urlResponseInfo) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that urlResponseInfo can actually be null (since right now everything is nullable).

Optional: consider using _ for the unused parameters.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I'm leaving the argument names since having comments for underscore looks weird.

@brianquinlan brianquinlan merged commit afda310 into dart-lang:master Jul 23, 2025
38 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 30, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/40607dc..7fbe88a):
  7fbe88a  2025-07-25  Jacob MacDonald  refine the prompt and fix the extension listener (dart-lang/ai#244)
  8d2384b  2025-07-25  Jacob MacDonald  add some intellij files to gitignore (dart-lang/ai#245)
  e09e469  2025-07-24  Jacob MacDonald  add prompt for using flutter driver to write a test for a user journey (dart-lang/ai#243)
  88d7a4d  2025-07-23  Jacob MacDonald  Flutter driver updates, add screenshot support back (dart-lang/ai#241)

http (https://github.com/dart-lang/http/compare/4a90d16..afda310):
  afda310  2025-07-23  Brian Quinlan  [cronet] Support aborting requests (dart-lang/http#1797)

test (https://github.com/dart-lang/test/compare/c201cc9..6aeb1e4):
  6aeb1e4f  2025-07-24  Nate Bosch  Consider NaN a match for itself (dart-lang/test#2524)
  65a37698  2025-07-23  Nate Bosch  Use latest analyzer and language version (dart-lang/test#2523)

web (https://github.com/dart-lang/web/compare/767151e..da1dd5d):
  da1dd5d  2025-07-24  Devon Carew  switch CI to using workflow files (dart-lang/web#428)
  8ffaf5e  2025-07-23  Nikechukwu  [interop] Implement Diagnostics and Handling Errors (dart-lang/web#426)

Change-Id: I499491c4c1466cb1c81cf5e4bbff4a484e880e57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442560
Auto-Submit: Devon Carew <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
AlexV525 added a commit to cfug/dio that referenced this pull request Aug 11, 2025
New versions of `http`, `cronet_http`, and `cupertino_http` support request cancellation (just like the `HttpClient` from `dart:io`).

Minor change to use `AbortableRequest` and pass the `cancelFuture` to the `abortTrigger` argument.

### Additional context and info (if any)

- [Add request cancellation to cupertino_http](dart-lang/http#1779)
- [[cronet] Support aborting requests](dart-lang/http#1797)
- [feat: support aborting HTTP requests](dart-lang/http#1773)

### Testing with ASP.NET Core API

Test Flutter app (Android and iOS only):

https://github.com/zzyzy/dio_lzz_fork_flutter/blob/main/lib/test_dio_request_cancellation.dart

Test API endpoint:
```csharp
    [HttpGet("request-cancellation")]
    public async Task<IActionResult> TestRequestCancellation(CancellationToken cancellationToken)
    {
        try
        {
            _logger.LogInformation("Request started {RequestID} {Platform}", HttpContext.TraceIdentifier,
                Request.Headers["X-App-Platform"]);
            
            await Task.Delay(TimeSpan.FromMinutes(5), cancellationToken);
            
            _logger.LogInformation("Request end {RequestID} {Platform}", HttpContext.TraceIdentifier,
                Request.Headers["X-App-Platform"]);
        }
        catch (TaskCanceledException)
        {
            _logger.LogInformation("Request canceled {RequestID} {Platform}", HttpContext.TraceIdentifier,
                Request.Headers["X-App-Platform"]);
            // Do nothing            
        }

        return Ok();
    }
```

#### Android

Before:
```
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:5292
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\ws\me\repos\my-code-vault\MyToolkit\TestAspNetCoreWebApi
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSG7:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSG8:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSG9:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSGA:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSGB:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB51JJSGC:00000001 Android
```

After:
```
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:5292
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\ws\me\repos\my-code-vault\MyToolkit\TestAspNetCoreWebApi
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMAV9NHQ97:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMAV9NHQ97:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMAV9NHQ98:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMAV9NHQ98:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMAV9NHQ99:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMAV9NHQ99:00000001 Android
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMAV9NHQ9A:00000001 Android
```

#### IOS

Before:
```
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:5292
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\ws\me\repos\my-code-vault\MyToolkit\TestAspNetCoreWebApi
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN4:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN5:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN6:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN7:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN8:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB42PERN9:00000001 IOS
```

After:
```
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:5292
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\ws\me\repos\my-code-vault\MyToolkit\TestAspNetCoreWebApi
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L0:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMB35NC5L0:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L1:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMB35NC5L1:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L2:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMB35NC5L2:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L3:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMB35NC5L3:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L4:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request canceled 0HNEMB35NC5L4:00000001 IOS
info: TestAspNetCoreWebApi.Controllers.TestController[0]
      Request started 0HNEMB35NC5L5:00000001 IOS

```

---------

Signed-off-by: Zhen Zhi Lee <[email protected]>
Co-authored-by: zhenzhi.lee <[email protected]>
Co-authored-by: Alex Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants